<?php

namespace App\Repositories\System;

use App\Presenters\System\SystemCodePresenter;
use App\Repositories\BaseRepository;
use Prettus\Repository\Criteria\RequestCriteria;
use App\Repositories\system\SystemCodeRepository;
use App\Models\System\SystemCode;
use App\Validators\System\SystemCodeValidator;

/**
 * Class SystemCodeRepositoryEloquent
 * @package namespace App\Repositories\System;
 */
class SystemCodeRepositoryEloquent extends BaseRepository implements SystemCodeRepository
{
    /**
     * Specify Model class name
     *
     * @return string
     */
    public function model()
    {
        return SystemCode::class;
    }

    /**
    * Specify Validator class name
    *
    * @return mixed
    */
    public function validator()
    {

        return SystemCodeValidator::class;
    }


    /**
     * Boot up the repository, pushing criteria
     */
    public function boot()
    {
        $this->pushCriteria(app(RequestCriteria::class));
    }

    public function presenter()
    {
        return SystemCodePresenter::class;
    }

    public function getSystemCodesByType($type)
    {
        return $this->skipPresenter()->findByField('type',$type);
    }
}
